﻿using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using AutoClub.Core.Domain;
using AutoClub.Resources;

namespace AutoClub.Models
{
    /// <summary>
    /// Modelo de Negocio para registrar un usuario nuevo al sistema
    /// </summary>
    public class RegisterModel
    {
        [Required(AllowEmptyStrings = false, ErrorMessageResourceName = "RequiredFieldError", ErrorMessageResourceType = typeof(PageResources))]
        [DataType(DataType.EmailAddress, ErrorMessageResourceName = "EmailFieldError", ErrorMessageResourceType = typeof(PageResources))]
        [Display(Name = "AccountName", ResourceType = typeof(PageResources))]
        public string Email { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessageResourceName = "RequiredFieldError", ErrorMessageResourceType = typeof(PageResources))]
        [StringLength(100, ErrorMessageResourceName = "StringLengthFieldError", ErrorMessageResourceType = typeof(PageResources), MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "PasswordName", ResourceType = typeof(PageResources))]
        public string Password { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessageResourceName = "RequiredFieldError", ErrorMessageResourceType = typeof(PageResources))]
        [StringLength(100, ErrorMessageResourceName = "StringLengthFieldError", ErrorMessageResourceType = typeof(PageResources), MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "PasswordConfirmationName", ResourceType = typeof(PageResources))]
        [Compare("Password", ErrorMessageResourceName = "PasswordDoesNotMatchFieldError", ErrorMessageResourceType = typeof(PageResources))]
        public string ConfirmPassword { get; set; }

        public IEnumerable<CarCategory> RaceCategories { get; set; }

        [Required(AllowEmptyStrings = false, ErrorMessageResourceName = "RequiredFieldError", ErrorMessageResourceType = typeof(PageResources))]
        [Display(Name = "CategoriesName", ResourceType = typeof(PageResources))]
        public CarCategoryEnum RaceCategorySelected { get; set; }
    }
}